package com.sunspring.zdcall.support;

import com.sunspring.zdcall.entity.ZdUserInfo;

/**
 * threadLocal保存登录的用户信息
 * @author wulei
 * @date 2019-01-03
 **/
public class ContextHolder {

    private static ThreadLocal<ZdUserInfo> threadLocal = new ThreadLocal<>();

    public static void add(ZdUserInfo userInfo) {
        threadLocal.set(userInfo);
    }

    public static void remove() {
        threadLocal.remove();
    }

    public static ZdUserInfo get() {
        return threadLocal.get();
    }

}
